<?php 
session_start();
error_reporting(E_ALL);
class tmp extends CI_Controller  {

        /**
        * Index Page for this controller.
        *
        * Maps to the following URL
        * 		http://example.com/index.php/welcome
        *	- or -  
        * 		http://example.com/index.php/welcome/index
        *	- or -
        * Since this controller is set as the default controller in 
        * config/routes.php, it's displayed at http://example.com/
        *
        * So any other public methods not prefixed with an underscore will
        * map to /index.php/welcome/<method_name>
        * @see http://codeigniter.com/user_guide/general/urls.html
        */
       private $_configs = null;
       function __construct()
        {
            parent::__construct();
            $this->load->helper('url');
            $this->load->library('javascript');
            //$this->load->library('session');
            $this->load->library('smarty3','','smarty');
            
            
        }
        public function index()
	{
            
            echo "start";
            require( APPPATH . 'libraries/phpmailer/class.phpmailer.php');
            
            $sEmail = ' khuongxuantruong@gmail.com '; // dia chi email se nhan mail 
            $sName = 'KXT';// ten nguoi nhan
            $sEmailSender = 'noreply@dealgiadung.com';// dia chi email cua nguoi goi 
            $sSenderName ='Dealgiadung'; // ten nguoi goi 
            $sHost ='mail.dealgiadung.com'; 
            $sUser ='noreply@dealgiadung.com';// tuong u'ng voi mail admin@phpasic.com 
            $sPass ='b0c057f0a715e648ac5dba9acf9c0ea6@THAILONG';// mat khau truy cap server mail 
            $sSub ='Contact From PHPBASIC'; // tieu de cho email 
            $Scontent = "Test send mail voi SMTP (dl: tptech.com.vn)"; 
            $mail = new PHPMailer(); 
            $mail->IsSMTP(); 
            $mail->Host = $sHost ; 
            $mail->Port="26";
            $mail->SMTPAuth = true; 
            $mail->Username = $sUser ; 
            $mail->Password = $sPass; 
            $mail->From = $sEmailSender;//$sEmailSender; 
            $mail->FromName = $sSenderName;//$sSenderName; 
            $mail->AddAddress($sEmail,$sName); 
            $mail->AddReplyTo($sEmailSender/*$sEmailSender*/,$sSenderName); 
            $mail->WordWrap = 50; 
            $mail->IsHTML(true); 
            $subject = $sSub; 
            $message = $Scontent; 
            $mail->Subject = $subject; 
            $mail->Body = $message; 
            $mail->AltBody = ""; 
            
            $mail->AddBCC("khuongxuantruong@zing.vn","ZKXT");
            if(!$mail->Send()){ 
                print $mail->ErrorInfo; 
                exit(); 
            }else{ 
                print "Successfull!"; 
            }
		
	}
        function get_parms(){
            echo "<pre>";
            echo  print_r($_SESSION);
            echo "</pre>";
        }
        function jqgrid_data(){
            $_SESSION["tmp"]=$_POST;
            $this->load->model('admin-planners/product_model','product_model');
            $result=$this->product_model->gettotal_rows();
            
            
            $rows=$result['rows'];
            
            $products = null;
            // get data and store in a json array
            foreach ($rows as $row) {
                    $products[] = array(
                            'id' => $row->id,
                            'name' => $row->name,
                            'status' => $row->status,
                            'startdate' => $row->startdate,
                            'enddate' => $row->enddate,
                            'insert' => $row->insert
                    );
            }
            
            $data[] = array(
                'TotalRows' => $result['total_rows'],
                'Rows' => $products
            );
            echo json_encode($data);
        }
        
        
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */